package com.example.yls.demoa;


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class MyBroadcastRecevier extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (action.equals("Weather_Report")) {
            String weather = intent.getStringExtra("Weather");
            int temp = intent.getIntExtra("temprature", 0);
            Log.e("MyBroadcastRecevier", "收到天气广播---"
                    + "今天天气：" + weather + "-" + "温度：" + temp);
        }
        else if (action.equals("Trafic_Report")){
            String trafic = intent.getStringExtra("Trafic");
            int time = intent.getIntExtra("Time", 0);
            Log.e("MyBroadcastRecevier", "收到交通广播---"
                    + "今天交通：" + trafic + "-" + "时间：" + time);
        }
    }
}
